//
//  LXUploadCarNumTableViewCell.m
//  lixing
//
//  Created by bancheng on 2022/3/7.
//

#import "LXUploadCarNumTableViewCell.h"

@implementation LXUploadCarNumTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
//    self.backgroundColor = ColorWithF8F8F8;

    [self.carNumTextF addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
    self.carNumTextF.delegate = self;
}
- (void) textFieldDidChange:(UITextField *) textField{
    NSString *textString=textField.text;
    if(_textfiledChangeBlock)
        _textfiledChangeBlock(textString);
}
- (IBAction)clickCarNumAction:(UIButton *)sender {
    if (self.clickCarNumBlock) {
        self.clickCarNumBlock();
    }
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
    
    NSString *shouldText = [textField.text stringByReplacingCharactersInRange:range withString:string];
    NSInteger strLength = shouldText.length;
    if (strLength > 7) {
        // 允许删除
        if (strLength < textField.text.length) {
            return YES;
        }
        return NO;
    }
    return [NSString numberAndLetter:shouldText];

}


@end
